home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
051-075
/
scopedisk64
/
blk
/
src
/
listmac.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-19
|
926b
|
26 lines
/* My MinNode definitions, basically, but with names
* that I like better for C applications
*/
struct Nod {
struct Nod *next,*prev;
};
struct Lst {
struct Nod *head,*tail,*tailprev;
};
/* some macros for dealing with Exec-like lists
* HEAD(lst) struct Lst *lst: gives first node
* TAIL(lst) struct Lst *lst: gives last node
* NEXT(nod) struct Nod *nod: gives next element
* PREV(nod) struct Nod *nod: gives previous element
* TEST(nod) struct Nod *nod: is non-zero for valid nodes
* OFF1(nod) struct Nod *nod: offsets backward one node
*/
#define HEAD(lst) (void *)(((struct Lst*)(lst))->head)
#define TAIL(lst) (void *)(((struct Lst*)(lst))->tailprev)
#define NEXT(nod) (void *)(((struct Nod *)(nod))->next)
#define PREV(nod) (void *)(((struct Nod *)(nod))->prev)
#define TEST(nod) NEXT(nod)
#define OFF1(nod) (void *)((char *)(nod)-sizeof(struct Nod))